#include <iostream>
class Logger {
public:
    virtual void log(const std::string& message) = 0;
};

class ConsoleLogger : public Logger {
public:
    void log(const std::string& message) override {
        std::cout << "Console log: " << message << std::endl;
    }
};

class FileLogger : public Logger {
public:
    void log(const std::string& message) override {
        // 将消息写入文件的代码
    }
};

class LoggerFactory {
public:
    virtual Logger* createLogger() = 0;
};

class ConsoleLoggerFactory : public LoggerFactory {
public:
    Logger* createLogger() override {
        return new ConsoleLogger();
    }
};

class FileLoggerFactory : public LoggerFactory {
public:
    Logger* createLogger() override {
        return new FileLogger();
    }
};

int main() {
    LoggerFactory* factory = new ConsoleLoggerFactory();
    Logger* logger = factory->createLogger();
    logger->log("Hello, Factory Method Pattern!");
    delete logger;
    delete factory;

    return 0;
}